package com.nineclock.sign.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.sign.dto.SignUserDTO;
import com.nineclock.sign.service.SignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@Api(value = "签到接口", tags = "签到服务")
public class SignController {
    @Autowired
    private SignService signService;

    /**
     * 考勤签到
     * 接口路径：POST/sign/insert
     * @param signUserDTO
     * @return
     */
    @ApiOperation("APP: 考勤签到")
    @PostMapping("insert")
    public Result insert(SignUserDTO signUserDTO){
        signService.sign(signUserDTO);
        return Result.success();
    }

    /**
     * 接口名称：APP: 获取当前用户当天签到次数
     * 未完成更新时间：2021-12-10 20:32:19
     * Tag ：签到服务
     * 接口路径：GET/sign/getDayCount
     * Mock地址：http://192.168.12.128:3000/mock/15/sign/getDayCount
     */
    @ApiOperation("APP: 获取当前用户当天签到次数")
    @GetMapping("getDayCount")
    public Result<Integer> getDayCount(){
        Integer dayCount = signService.getDayCount();
        return Result.success(dayCount);
    }


}
